<?php

$siteID = "";

$editcontent = "";

$mode = "";

$section = "";

if(@$_GET['siteid']){
	
	$siteID = $_GET['siteid'];
}

if(@$_GET['editcontent']){
	
	$editcontent = $_GET['editcontent'];
}

if(@$_GET['mode']){
	
	$mode = $_GET['mode'];
}

if(@$_GET['xmlsection']){
	
	$section = $_GET['xmlsection'];
}

if($mode == "add"){
	
	$arrExistLans = getExistLans();
	
	$size = count($arrExistLans);
	
	$counter = 0;

	foreach($arrExistLans as $itemExistLans){
		
		$curLanID = str_replace("en(",$itemExistLans['x_language']."(",$siteID);
		
		$updatesql = "UPDATE ".$PROJECT_DB_TABLES["tags"]." SET x_interaction='".$editcontent."' WHERE x_id = '".$curLanID."'";
		
		if(executeSQLQuery($updatesql)){
			
			$counter ++;
		}
		else
			break;
		
	}
	
	if($size == $counter){
		
		addContent("<b>Interaction:</b><br/><textarea readonly=\"readonly\" cols=\"60\" rows=\"10\">".$editcontent."</textarea><a href=\"javascript:void(0)\" onclick =\"onclick_editInteraction('".$siteID."','".$section."')\">Edit</a>");
	}
	
}
else if($mode == "save"){
	
	$updatesql = "UPDATE ".$PROJECT_DB_TABLES["tags"]." SET x_interaction='".$editcontent."' WHERE x_id = '".$siteID."'";
	
	if(executeSQLQuery($updatesql)){
		
		$currentTag = $XML1 -> getTag($siteID);
		
		if($currentTag -> getData('x_language')== "en"){
			
			addContent("<b>Interaction:</b><br/>".$editcontent."<a href=\"javascript:void(0)\" onclick =\"onclick_editInteraction('".$siteID."','".$section."')\">Edit</a>");
		}
		else{
			
			$arrEnVersion = getEnglishVersion($currentTag -> getData('x_section'),$currentTag -> getData('x_path'));
			
			addContent("<b>English Interaction:</b><br/>".$arrEnVersion['x_interaction']."(EN)<br/>");//<a href=\"javascript:void(0)\" onclick =\"onclick_editInteraction('".$siteID."','".$section."')\">Edit</a>
			
			addContent("<b>Interaction:</b><br/>".$editcontent."<br/><a href=\"javascript:void(0)\" onclick =\"onclick_editInteraction('".$siteID."','".$section."')\">Edit</a>");
		}
	}
}

?>